﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display {
    import flash.events.*;
    import Engine.Managers.*;
    import flash.display.*;
    import Events.*;
    import Transactions.*;
    import Classes.util.*;

    public class TakePhotoPopup extends SWFDialog {

        public var m_window:MovieClip;
        private var m_bmp:BitmapData;
        private var m_accept:GenericButton;

        public function TakePhotoPopup(_arg1:BitmapData){
            m_dialogAsset = "assets/dialogs/FV_CameraPopUp.swf";
            super();
            this.m_bmp = _arg1;
            StatsManager.count("take_photo_popup", "view");
        }
        override protected function onLoadComplete():void{
            var _local1:Array = [];
            this.m_window = (m_loader.content as MovieClip);
            var _local2:Bitmap = new Bitmap(this.m_bmp);
            _local2.width = 198.5;
            _local2.height = 197.2;
            this.m_window.popupBox_mc.caption_tf.text = "";
            this.m_window.popupBox_mc.snapshot_mc.addChild(_local2);
            this.m_accept = new GenericButton(this.m_window.popupBox_mc.accept_bt, this.onAccept);
            this.m_accept.text = ZLoc.t("Dialogs", "Accept");
            this.m_window.popupBox_mc.close_bt.addEventListener(MouseEvent.CLICK, this.onCancel);
            addChild(this.m_window);
        }
        protected function onAccept(_arg1:MouseEvent):void{
            var _local3:String;
            var _local2:String = this.m_window.popupBox_mc.caption_tf.text;
            dispatchEvent(new TakePhotoEvent(TakePhotoEvent.ACCEPT, _local2));
            this.removeListeners();
            StatsManager.count("take_photo_popup", "accept_click");
            if (Global.isVisiting() == true){
                _local3 = Global.getVisiting();
            } else {
                _local3 = Global.player.uid;
            };
            GameTransactionManager.addTransaction(new TTakePhoto(_local3));
        }
        protected function onCancel(_arg1:MouseEvent):void{
            dispatchEvent(new TakePhotoEvent(TakePhotoEvent.CANCEL, ""));
            this.removeListeners();
            StatsManager.count("take_photo_popup", "cancel_click");
        }
        private function removeListeners():void{
            this.m_window.popupBox_mc.close_bt.removeEventListener(MouseEvent.CLICK, this.onCancel);
            close();
            StatsManager.count("take_photo_popup", "cancel_click");
        }

    }
}//package Display 
